import {createRouter, createWebHistory} from 'vue-router'

const routes = [
    {
        path: '/login',
        name: 'login',
        meta: {title: '登录'},
        component: () => import('@/views/Login.vue'),
    },
    {
        path: '/register',
        name:'register',
        meta: {title: '注册'},
        component: () => import('@/views/Register.vue'),
    },
    {
        path: '/password',
        name: 'password',
        meta: {title: '忘记密码'},
        component: () => import('@/views/Password.vue'),
    },

    //home
    {
        path: '/home',
        name: 'home',
        meta: {title: '首页'},
        component: () => import('@/views/home/Home.vue'),
    },
    {
        path: '/SimpleTable',
        name: 'SimpleTable',
        meta: {title: '简单表格'},
        component: () => import('@/views/test/SimpleTable.vue'),
    },

]

const router = createRouter({
    history: createWebHistory(),
    routes
})
router.beforeEach((to, from, next) => {
    next(); // 继续路由跳转
});
router.afterEach((to, from) => {
    document.title = to.meta.title || '佚名';
})
export default router;























